import java.io.File;
import java.io.IOException;

import jxl.Cell;
import jxl.CellType;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

public class ReadExcel {

  private String inputFile;

  public void setInputFile(String inputFile) {
    this.inputFile = inputFile;
  }

  public double[][] read() throws IOException  {
    File inputWorkbook = new File(inputFile);
    Workbook w;
    try {
      w = Workbook.getWorkbook(inputWorkbook);
      // Get the first sheet
      Sheet sheet = w.getSheet(0);
      // Loop over first 10 column and lines
      
      
		
		
		
		
		
		
		
		//Cooling load at that hour point
		 Cell[] coolLoad_t_array = sheet.getColumn(0);
		 
		 //t-24
		 Cell[] coolLoad_t24_array = sheet.getColumn(1);
		 // t- 168
		 Cell[] coolLoad_t168_array = sheet.getColumn(2);
		 
		//Max Temperature
		 Cell[] Tmax_array = sheet.getColumn(3);
			
		//Min Temperature 
		 Cell[] Tmin_array = sheet.getColumn(4);
		 
		//Temperature at that hour point
		 Cell[] T_array = sheet.getColumn(5);
		 
		 Cell[] T24_array = sheet.getColumn(6);
		 
		 Cell[] T168_array = sheet.getColumn(7);
		 
		 Cell[] RHt_array = sheet.getColumn(8);
		 
		 Cell[] RHt24_array = sheet.getColumn(9);
		 
		 Cell[] RHt168_array = sheet.getColumn(10);
		 
		 int length = coolLoad_t_array.length;
		 double[][] data = new double[length][17];
		 
		 for(int i = 0; i < data.length; i++){
			 
			 
			 data[i][0] = Double.parseDouble(coolLoad_t_array[i].getContents());
			 data[i][1] = 1d;
			 data[i][2] = Double.parseDouble(coolLoad_t24_array[i].getContents());
			 data[i][3] = Double.parseDouble(coolLoad_t168_array[i].getContents());
			 data[i][4] = Double.parseDouble(Tmax_array[i].getContents());
			 data[i][5] = Double.parseDouble(Tmin_array[i].getContents());
			 data[i][6] = Double.parseDouble(T_array[i].getContents());
			 data[i][7] = Double.parseDouble(T24_array[i].getContents());
			 data[i][8] = Double.parseDouble(T168_array[i].getContents());
			 data[i][9] = Double.parseDouble(RHt_array[i].getContents());
			 data[i][10] = Double.parseDouble(RHt24_array[i].getContents());
			 data[i][11] = Double.parseDouble(RHt168_array[i].getContents());
//			 data[i][11] = 1d;
			 
		 }
		return data;
      
    } catch (BiffException e) {
      e.printStackTrace();
    }
	return null;
	
  }

  

} 